认识表单
什么是表单?
表单是一个包含表单元素的区域,表单元素是允许用户在表单中(比如:文本域、下拉列表、单选框、复选框等等)输入信息的元素。
使用form标签定义
1
2
3
4<form action="Url" method="get">
<p>用户名:<input type="text" name="username" /></p>
<p>密码:<input type="text" name="password" /></p>
</form>
input
input标签的类型有很多种,以下是一些常见的类型
- password
- button
- checkbox
- radio
- file
- hidden
- reset
- submit
- color
- date
1 | <!-- eg --> |
1 | <!-- |
textarea
1 | <textarea rows="3" cols="30" style="resize: none"> |
select
1 | <!-- size默认显示几个 --> |